package com.kgc.controller;

import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.kgc.pojo.User;

@Controller
@SessionAttributes(value = {"user"})
public class TestSessionAttributeController
{
    @RequestMapping("/testHandler")
    public String testHandler(Model model, User user)
    {
        model.addAttribute("user", user);
        return "result";
    }
    
    @RequestMapping("/test")
    public void test(HttpSession session)
    {
        System.out.println(session.getAttribute("user"));
    }
    
//    @RequestMapping("/login.do")
//    public String login(User user,HttpSession session)
//    {
//        System.out.println(user);
//        session.setAttribute("user", user);
//        return "test";
//    }
//    
//    @RequestMapping("/test22")
//    public void test22(HttpSession session)
//    {
//        System.out.println(session.getAttribute("user"));
//    }
}
